{include file="header.html"}
<div id="page_main" class="main-right">
  <div id="rightTop">
    <p>{$lang.recommend}</p>
    <ul class="subnav">
      <li><a class="btn1" href="{url route='recommend/index'}">{$lang.manage}</a></li>
      <li><a class="btn1" href="{url route='recommend/add'}">{$lang.add}</a></li>
      <li><span>{$lang.recommend_goods}</span></li>
    </ul>
  </div>
  <div id="flexigrid"></div>
</div>
<script type="text/javascript">
$(function(){
    $("#flexigrid").flexigrid({
    	url: url(['recommend/goods', { id: '{$smarty.get.id}'}]),
    	colModel : [
    		{ display: '{$lang.operation}', name : 'operation', width : 200, sortable : false, align: 'center', className: 'handle'},
			{ display: '{$lang.recom_name}', name : 'recom_name', width: 100, sortable : false, align : 'center'},
			{ display: '{$lang.goods_name}', name : 'goods_name', width : 650, sortable : false, align: 'left'},
			{ display: '{$lang.price}', name : 'price', width : 50, sortable : false, align: 'center'},
    		{ display: '{$lang.store_name}', name : 'store_name', width : 100, sortable : false, align: 'center'}	
    	],
        buttons : [
            { display: '<i class="fa fa-ban"></i>{$lang.recommend_cancel}', name : 'cancel', bclass : 'del', title : '{$lang.recommend_cancel}', onpress : fg_operate }
        ],
    	title: '{$lang.recommend_goods}'
    });
});
function fg_operate(name, bDiv) {
	var itemlist = new Array();
	$('.trSelected',bDiv).each(function(){
		itemlist.push($(this).attr('data-id'));
	});
	if(name == 'cancel') {
	   if($('.trSelected',bDiv).length == 0){
		   	layer.msg(lang.no_selected_item);
			return false;
	   }
       fg_cancel(itemlist, 'recommend');
	}
}
</script> 
{include file="footer.html"} 